# -*- coding: utf-8 -*-

# @Author: Chen Hua
# @Date  : 2020-07-11
# @Desc  : 中国GDP数据

import sys
import datetime
import time

from sqlalchemy.sql.elements import and_

from db.MySqlConn import DBSession, JobConfig, engine as eg, CnGDP, IndexValue
import service.job_config_service as js
from util import DateUtil
import tushare as ts
from conf.settings import TUSHARE_TOKEN

##tushare sdk
ts.set_token(TUSHARE_TOKEN)
pro = ts.pro_api()
##链接数据库
session = DBSession()
job_name = 'stock_cn_gdp'

"""
详情：
https://tushare.pro/document/2?doc_id=227
"""


def process_gdp_api():
    pro = ts.pro_api()
    df = pro.cn_gdp(start_q='2004Q1', end_q='2019Q3')
    if df.empty:
        print("没有数据返回，请检查是否出错NEW...")
    for index, row in df.iterrows():
        print(row)



if __name__ == "__main__":
    process_gdp_api()
